package com.example.dragandview.VerticalSlidle;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.example.dragandview.R;

import java.util.ArrayList;
import java.util.List;


public class VerticalSlideActivity extends Activity {
    private ListView lv_verticalslide;
    private List<String> mItems;
    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.verticalslide_index);
        lv_verticalslide = findViewById(R.id.lv_verticalslide);
        mItems = new ArrayList<String>();
        for (int i=0;i<200;i++){
            mItems.add("i -> "+i);
        }
        lv_verticalslide.setAdapter(new BaseAdapter() {
            @Override
            public int getCount() {
                return mItems.size();
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                TextView tv = (TextView) LayoutInflater.from(VerticalSlideActivity.this).inflate(R.layout.item_lv,parent,false);
                tv.setText(mItems.get(position));
                return tv;
            }
        });

    }
}
